<template>
  <div class="copy-list big">
    <span class="text">
      <div class="divClass">
        <label>
          <slot name="label">{{ label }}</slot>
        </label>
      </div>
      <slot/>
    </span>
    <el-button v-if="showButton" type="text" class="destroy" @click="clickButton">{{ buttonName }}</el-button>
  </div>
</template>

<script>
export default {
  name: 'FormWithButton',
  props: {
    label: {
      type: String,
      default: null
    },
    labelWidth: {
      type: String,
      default: null
    },
    buttonName: {
      type: String,
      default: '复制'
    },
    showButton: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {};
  },
  methods: {
    clickButton(evt) {
      this.$emit('click', evt);
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss"  scoped>

  .divClass{
    float:left
  }
  .copy-list {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 20px;
    padding-right: 20px;
    position: relative;
  }
  .text{
    /*margin-left: 10px;*/
  }
  .big{
     margin-left: -20px;
    margin-right: -20px;
  }
  .big:hover{
    background: rgba(0, 22, 255, 0.03);
    /*transition: all 0.3s linear;*/
    /*transform: scale(1.1, 1.1);*/
  }

   .destroy {
    display: none;
    position: absolute;
    top: 0;
    right: 10px;
    bottom: 0;
    width: 40px;
    height: 40px;
    margin: auto 0;
    font-size: 12px;
    /*color: #cc9a9a;*/
    padding: 0;
    border: 0;
    background: none;
    vertical-align: baseline;
    font-family: inherit;
    font-weight: inherit;
    -webkit-appearance: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    content: '';
    transition: color 0.2s ease-out;
    cursor: pointer;
    &:hover{
      /*color: #af5b5e;*/
    }
  }

  .copy-list:hover .destroy {
    display: inline;
  }
</style>
